package br.ufpb.esa.plataforma.controller;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.image.ImageView;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.AnchorPane;
import javafx.scene.shape.Rectangle;

public class MontarAlgoritmoController extends AnchorPane {

	@FXML
	private ImageView figuraInicio;
	@FXML
	private ImageView figuraFim;
	@FXML
	private ImageView figuraCalculo;
	@FXML
	private ImageView figuraEntrada;
	
	public MontarAlgoritmoController(){
		FXMLLoader fxmlLoader = new FXMLLoader(

				   getClass().getResource("/br/ufpb/esa/plataforma/view/SceneMontarAlgoritmo.fxml"));
		
		fxmlLoader.setRoot(this);
		fxmlLoader.setController(this);

		try {
			fxmlLoader.load();
		} catch (IOException exception) {
			throw new RuntimeException(exception);
		}
	}
	
	public static void main(String[]args){
		MontarAlgoritmoController montar = new MontarAlgoritmoController();
	}
	
	
	/*
	public void dragAndDropComandos(DragEvent evento) {
		this.comando.getScaleX();
		this.comando.getScaleY();

		this.pane.getScaleX();
		this.pane.getScaleY();

		comando.setOnDragDetected(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent evento) {
				Dragboard drag = comando.startDragAndDrop(TransferMode.ANY);

				ClipboardContent content = new ClipboardContent();
				content.putString(comando.getId());
				drag.setContent(content);
				evento.consume();

			}
		});

		this.pane.setOnDragOver(new EventHandler<DragEvent>() {
			@Override
			public void handle(DragEvent evento) {
				if (evento.getGestureSource() != pane
						&& evento.getDragboard().hasString()) {
					evento.acceptTransferModes(TransferMode.COPY_OR_MOVE);
				}

				evento.consume();
			}
		});

		this.pane.setOnDragDropped(new EventHandler<DragEvent>() {
			@Override
			public void handle(DragEvent evento) {
				Dragboard drag = evento.getDragboard();
				Boolean concluido = false;
				if (drag.hasString()) {
					pane.setClip(comando);
					concluido = true;
				}

				evento.setDropCompleted(concluido);

				evento.consume();
			}
		});

		this.comando.setOnDragDone(new EventHandler<DragEvent>() {
			@Override
			public void handle(DragEvent evento) {
				if (evento.getTransferMode() == TransferMode.MOVE) {
					comando.setClip(comando);
				}

				evento.consume();
			}
		});
	}
	*/

}
